diff options
| author | Adam Soltys <[email protected]> | 2022-11-12 01:40:54 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-11-12 01:40:54 -0800 |
| commit | 9764d0f0989ea25a502572453ee4f992079f520f (patch) | |
| tree | af9d6efbae922b388f669a50ba048cff2da88a17 /src/routes/(app)/[username]/dashboard | |
| parent | 2a8e54dcdc7c7f780253b1d7f9cf3552dcba3ff2 (diff) | |
| download | coinos-ui-9764d0f0989ea25a502572453ee4f992079f520f.tar.gz coinos-ui-9764d0f0989ea25a502572453ee4f992079f520f.zip | |
persist requests
Diffstat (limited to 'src/routes/(app)/[username]/dashboard')
| -rw-r--r-- | src/routes/(app)/[username]/dashboard/+page.server.js | 3 | ||||
| -rw-r--r-- | src/routes/(app)/[username]/dashboard/+page.svelte | 62 |
2 files changed, 64 insertions, 1 deletions
diff --git a/src/routes/(app)/[username]/dashboard/+page.server.js b/src/routes/(app)/[username]/dashboard/+page.server.js new file mode 100644 index 00000000..b283bc9d --- /dev/null +++ b/src/routes/(app)/[username]/dashboard/+page.server.js @@ -0,0 +1,3 @@ +import { auth, get } from '$lib/utils'; + +export let load = async ({ cookies }) => get('/requests', auth(cookies)); diff --git a/src/routes/(app)/[username]/dashboard/+page.svelte b/src/routes/(app)/[username]/dashboard/+page.svelte index d1bd86b7..3cba081d 100644 --- a/src/routes/(app)/[username]/dashboard/+page.svelte +++ b/src/routes/(app)/[username]/dashboard/+page.svelte @@ -1,12 +1,13 @@ <script> import { f, s, post, failure, sat, sats } from '$lib/utils'; import { tick } from 'svelte'; - import { Icon } from '$comp'; + import { Avatar, Icon } from '$comp'; import { rate, selectedRate } from '$lib/store'; import { goto } from '$app/navigation'; import { t } from '$lib/translations'; export let data; + $: ({ invoices, requests } = data); let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t); let interval, rateInterval; @@ -88,6 +89,65 @@ > </a> </div> + + {#each invoices as { amount, currency, rate, user, uuid }} + <div class="border-b p-2 last:border-b-0 hover:bg-gray-100"> + <div class="flex"> + <div> + <div class="flex"> + <Avatar {user} size={20} /> + <div class="my-auto text-left"> + <p class="ml-1 text-lg break-words">{user.username}</p> + </div> + </div> + </div> + <div class="whitespace-nowrap my-auto mx-auto flex gap-2"> + <div class="font-bold"> + {f(amount * (rate / sats), currency)} + </div> + + <div class="text-secondary">{sat(amount)}</div> + </div> + <div class="flex ml-auto my-auto gap-2"> + <a href={`/invoice/${uuid}`}> + <div class="p-2 border rounded-xl bg-white flex"> + <Icon icon="send" style="w-8 opacity-50 hover:opacity-100" /> + </div> + </a> + <a href={`/invoice/${uuid}`}> + <div class="p-2 border rounded-xl bg-white flex"> + <Icon icon="close" style="w-8 opacity-50 hover:opacity-100" /> + </div> + </a> + </div> + </div> + </div> + {/each} + + <div> + {#each requests as { id, invoice, memo, requester: r }} + <div class="border-b p-2 last:border-b-0 hover:bg-gray-100"> + <div class="flex"> + <div> + <div class="flex"> + <Avatar user={r} size={20} /> + <div class="my-auto text-left"> + <p class="ml-1 text-lg break-words">{r.username}</p> + <p class="ml-1 text-secondary">{memo}</p> + </div> + </div> + </div> + <div class="flex ml-auto my-auto"> + <a href={`/${user.username}/receive/${id}`}> + <div class="p-2 border rounded-xl bg-white flex"> + <Icon icon="numpad" style="w-8 opacity-50 hover:opacity-100" /> + </div> + </a> + </div> + </div> + </div> + {/each} + </div> </div> <div class="flex fixed bottom-4 w-full px-4"> |
